var backBtn = null;
var LocString = String(window.document.location.href);
function GetQueryString(name) {
	var rs = new RegExp("(^|)" + name + "=([^&]*)(&|$)", "gi").exec(LocString), tmp;
	if (tmp = rs) {
		return decodeURI(tmp[2]);
	}
	// parameter cannot be found
	return "";
}
$(function(){
	var	billCode = $("#billCode");
	var	productName = $("#productName");
	var	productUnit = $("#productUnit");
	var	productCount = $("#productCount");
	var	totalPrice = $("#totalPrice");
	var	proName = $("#proName");
	var isPayment = $("#isPayment");
	$.get("bill/"+GetQueryString("billId"),function (data) {
		if (data.code===200){
			let is = "已支付";
			var bill = data.data;
			if (bill.isPayment===2){
				is="未支付"
			}
			billCode.html(bill.billCode)
			productName.html(bill.productName)
			productUnit.html(bill.productUnit)
			productCount.html(bill.productCount)
			totalPrice.html(bill.totalPrice)
			proName.html(bill.proName)
			isPayment.html(is)
		}else {
			alert("查看出问题了1")
		}
	})
	backBtn = $("#back");
	backBtn.on("click",function(){
		//alert("view : "+referer);
		if(referer != undefined
			&& null != referer
			&& "" != referer
			&& "null" != referer
			&& referer.length > 4){
			window.location.href = referer;
		}else{
			history.back(-1);
		}
	});
});